import * as API from "../api";
import Base from "./base";

class Upload extends Base {
  get actions() {
    return {
      //上传图片
      IMG_UPLOAD_ACTION: async (store, payload) => {
        try {
          let formdata = new FormData();
          formdata.append(payload.type, payload.file);
          let result = await this.upload(API.Upload, formdata);
          if (result && result.code === 1) {
            return result;
          }
        } catch (error) {
          console.error(error);
        }
      }
    };
  }
}

export default new Upload();